<?php
    @header("Content-type:text/html;charset=utf-8");
    @include_once("./connect.php");

    if(!(isset($_POST["user"])&&isset($_POST["pwd"]))){
        $obj = array();
        $obj["status"] = false;
        $obj["msg"] = "请传入完整参数";
        $json = json_encode($obj);
        exit($json);
    }
    $user = $_POST["user"];
    $pwd = $_POST["pwd"];

    $sql = "select * from `userinfo` where user='$user' or email='$user' or phone='$user'";

    $result = mysqli_query($conn,$sql);

    $obj = array();
    if($result){
        $item = mysqli_fetch_assoc($result);
        if($item){
            if($item["pwd"] === $pwd){
                $obj["status"] = true;
                $obj["msg"] = "成功";
                $obj["list"] = $item;
            }else{
                $obj["status"] = false;
                $obj["msg"] = "账号或密码错误";
            }
        }else{
            $obj["status"] = false;
            $obj["msg"] = "您还没有注册";
        }
    }else{
        $obj["status"] = false;
        $obj["msg"] = "sql语句有误";
        $obj["sql"] = $sql;
    }
    echo json_encode($obj);




?>